<?php

function get_anzahl_bestaetigungen($u)
{
	include("inc_configuration.php");
	$query = "	SELECT 	m.id AS id,
						t1.name AS hN,
						t2.name AS gN,
						c1.userId AS hU,
						c2.userId AS gU,
						m.homeG AS hG,
						m.guestG AS gG,
						b.homeB AS hB,
						b.guestB AS gB
				FROM 	$tbl_matches m, 
						$tbl_teams t1, 
						$tbl_teams t2, 
						$tbl_bestaetigung b, 
						$tbl_combinations c1, 
						$tbl_combinations c2
				WHERE
					m.free=2 AND
					m.id=b.matchId AND
					m.homeT=t1.id AND
					m.guestT=t2.id AND
					m.homeC=c1.id AND
					m.guestC=c2.id
					";

	$q = mysql_query($query);

	$c = mySQL_num_rows($q);

	$anz=0;
	
	if ($c>0)
	{

		while ($i = mysql_fetch_object($q))
		{
			$hU=$i->hU;
			$gU=$i->gU;
			$hB=$i->hB;
			$gB=$i->gB;
			$b=0;
			
			if (
					(($hU==$u) 
					AND 
					($hB!=1)) 
					OR 
					(($gU==$u) 
					AND 
					($gB!=1)))
			{
				$anz++;
			}
		}
	}	
	return ($anz);
}








//echo 'Sie werden weitergeleitet... <meta http-equiv="refresh" content="3; URL=lima.php">   ';

?>